<?php
/**
 * Xml数据生成
 * @author song
 * @date 2011-05-24
 */
class Xml
{
	/*
	 * 在Sae上生成xml文件，返回Xml文件的地址
	 */
	public static function generateXml($domain, $filename, $content)
	{
		$storage = new SaeStorage();
		$isExists = $storage->fileExists($domain, $filename);
		if ($isExists) {
			$del = self::delete($domain, $filename);
		}
		$result = $storage->write($domain, $filename, $content);
		if (!$result) {
			Util::log('SaeStorage Error :'. $storage->errno() .'Error Message :'. $storage->errmsg());
		}
		return $result;
	}
	
	public static function getUrl($domain, $filename)
	{
		$storage = new SaeStorage();
		$url = $storage->getUrl($domain, $filename);
		if (!$url) {
			return false;
		}
		return $url;
	}
	
	
	public static function delete($domain, $filename)
	{
		$storage = new SaeStorage();
		$result = $storage->delete($domain, $filename);
		if (!$result) {
			return FALSE;
		}else {
			return $result;
		}
	}
}